package com.spring.framework.ioc.bean.post;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * BeanDefinition 加载阶段,可以修改 bean 注册信息.
 *
 * @author xuweizhi
 * @since 2020/12/04 21:38
 */
@Component
public class CustomizeBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

	/**
	 * 调用我们的后置处理器{@link org.springframework.context.support.PostProcessorRegistrationDelegate#invokeBeanFactoryPostProcessors}
	 * <p>
	 * 大概在 236 行
	 */
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		BeanDefinition school = beanFactory.getBeanDefinition("school");
		//System.out.println(school);
	}
}
